From 006207e95e66075db6b088a4be1d25de0fb14f35 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 24 Oct 2017 16:09:17 +0800 Subject: [PATCH] gdk/win32/gdkwindow-win32.c: Fix gdk_win32_window_set_icon_list() The list of surfaces passed into the function may be NULL, so don't try to initialize the surfaces if it is so, to avoid a crash. Also, remove the cast to GdkPixbuf* for getting surfaces->data, as we are already using a cairo_surface_t*. https://bugzilla.gnome.org/show_bug?id=773299 --- gdk/win32/gdkwindow-win32.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 65402bac45..07e5255395 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -2328,7 +2328,7 @@ gdk_win32_window_set_icon_list (GdkWindow *window, g_return_if_fail (GDK_IS_WINDOW (window)); - if (GDK_WINDOW_DESTROYED (window)) + if (GDK_WINDOW_DESTROYED (window) || surfaces == NULL) return; impl = GDK_WINDOW_IMPL_WIN32 (window->impl); @@ -2344,9 +2344,10 @@ gdk_win32_window_set_icon_list (GdkWindow *window, small_surface = NULL; big_diff = 0; small_diff = 0; + while (surfaces) { - surface = (GdkPixbuf*) surfaces->data; + surface = surfaces->data; w = cairo_image_surface_get_width (surface); h = cairo_image_surface_get_height (surface); -- 2.30.2